import { request } from "@/common/request";
// +---------------------
// | 订单支付相关
// +---------------------

/**
 * 计算订单金额
 * @param {*} data
 * @returns
 */
export function calculateOrderAmount(data: any) {
  return request({
    url: `/kingon-service-order/kingon-warehousesupplier/buffetOrder/calculateOrderAmount`,
    method: "post",
    data,
  });
}

/**
 * 检查支付结果
 * @param {*} data
 * @returns
 */
export function checkPayResult(data: any) {
  return request({
    url: `/kingon-service-order/kingon-warehousesupplier/buffetOrder/checkPayResult`,
    method: "get",
    data,
  });
}

/**
 * 餐助订单支付
 * http://172.10.0.21:32881/doc.html#/%E5%B1%85%E5%AE%B6-%E8%AE%A2%E5%8D%95%E6%A8%A1%E5%9D%97/%E5%8A%A9%E9%A4%90%E8%AE%A2%E5%8D%95/payBuffetOrderUsingPOST
 * @param {*} data
 * @returns
 */
export function payBuffetOrder(data: any) {
  return request({
    url: `/kingon-service-order/kingon-warehousesupplier/buffetOrder/payBuffetOrder`,
    method: "post",
    data,
    // header: {
    //   "Pay-Code": import.meta.env.VITE_PAY_CODE,
    // },
  });
}

/**
 * 帮助下单 (PC)
 * @param {*} data
 * @returns
 */
export function pcSave(data: any) {
  return request({
    url: `/kingon-service-order/kingon-warehousesupplier/buffetOrder/pcSave`,
    method: "post",
    data,
  });
}

// 消费机自由消费模式和定额消费模式 下单
export function fixedConsumption(data: any) {
  return request({
    url: `/kingon-service-order/kingon-warehousesupplier/buffetOrder/fixedConsumption`,
    method: "post",
    data,
  });
}


/**
 * app创建订单(暂不使用)
 * @param {*} data
 * @returns
 */
export function buffetOrderAppSave(data: any) {
  return request({
    url: `/kingon-service-order/kingon-warehousesupplier/buffetOrder/save`,
    method: "post",
    data,
  });
}


// +---------------------
// | 退款管理
// +---------------------

/**
 * 申请退款
 * @param {*} data
 * @returns
 */
export function refundApplicationSave(data: any) {
  return request({
    url: `/kingon-service-order/refundApplication/save`,
    method: "post",
    data,
  });
}

/**
 * 按菜品退款
 * @param {*} data
 * @returns
 */
export function onDemandRefund(data: any) {
  return request({
    url: `/kingon-service-order/refundApplication/onDemandRefund`,
    method: "post",
    data,
  });
}

/**
 * 商家app同意申请
 * @param {*} data
 * @returns
 */
export function agreeRefund(data: any) {
  return request({
    url: `/kingon-service-order/refundApplication/businessAgreeRefund`,
    method: "post",
    data,
  });
}

/**
 * 商家app驳回申请
 * @param {*} data
 * @returns
 */
export function businessReject(data: any) {
  return request({
    url: `/kingon-service-order/refundApplication/businessReject`,
    method: "post",
    data,
  });
}

/**
 * 申请详情
 * @param {*} data
 * @returns
 */
export function refundApplicationDetail(data: any) {
  return request({
    url: `/kingon-service-order/refundApplication/detail`,
    method: "get",
    data,
  });
}

/**
 * pc服务工单申请退款
 * @param {*} data
 * @returns
 */
export function requestRefundForPC(data: any) {
  return request({
    url: `/kingon-service-order/refundApplication/requestRefund`,
    method: "post",
    data,
  });
}

/**
 * 用户餐补发放记录
 * @param {*} data
 * @returns
 */
export function listRecordById(data: any) {
  return request({
    url: `/kingon-customer/customerSupplementRecord/listRecordById`,
    method: "get",
    data,
  });
}